<%@ page contentType="text/html;charset=UTF-8"%>
<%@include file="../common/sessionValidate.jsp" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML>
<html lang="UTF-8">
  <head>
    <title>密码修改页</title>
    <%@ include file="../common/meta.jsp"%>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="X-UA-Compatible" content="IE=9">
	<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <link rel="stylesheet" href="<%=basePath%>css/my-bootstrap.css" media="screen" id="tuserskin" >
    <link rel="stylesheet" href="<%=basePath%>js/toastr/toastr.css">
    <link rel="stylesheet" href="<%=basePath%>css/bootstrapValidator.min.css">
    <script type="text/javascript" src="js/jquery.cookie.js"></script>
  </head>
  <style>j
hr {
    margin-top:1px;
    border-bottom: 1px solid #1BBC9B;
}
  </style>
  <body>
  <form class="form-horizontal form-bordered form-row-strippe" name="ffAdd" id="ffAdd" mentod="post" role="form" data-toggle="validator" enctype="multipart/form-data">
  <div class="" style="margin-right:2px;padding-right:1px;">

   <!-------------------------- 面板  start--------------------------------->
	<div class="panel panel-primary" >
	  <div class="panel-heading clearfix"  id="addHeaderDiv">
	  密码修改
	  </div>
	  <div class="panel-body">
           <div class="row" >
                <h5>&nbsp;&nbsp;修改信息</h5>
	            <hr>
            	<div class="col-md-6"><!--start 换列-->
                    <div class="col-md-12">
                        <div class="form-group">
                            <label class="control-label col-md-4"> 老密码</label>
                            <div class="col-md-8">
                                <input id="oldpassword" name="oldpassword" type="password" class="form-control" placeholder="请输入老密码" />
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="form-group">
                            <label class="control-label col-md-4"> 新密码</label>
                            <div class="col-md-8">
                                <input id="newpassword" name="newpassword" type="password" class="form-control" placeholder="请输入新密码" />
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="form-group">
                            <label class="control-label col-md-4"> 再次输入新密码</label>
                            <div class="col-md-8">
                                <input id="renewpassword" name="renewpassword" type="password" class="form-control" placeholder="请再次输入新密码" />
                            </div>
                        </div>
                    </div>

                </div>
             </div>
       </div><!--end body-->

	   <div class="modal-footer bg-info " id='buttonDiv'>
	   		<button type="submit" class="btn btn-sm btn-primary" name="editSaveButton" id="editSaveButton" onClick="mdfsubmit()">修改</button>
			<button type="button" class="btn btn-sm btn-danger" data-dismiss="modal" onclick="history.go(-1)">返回</button>
	   </div>
    </div>
    <!--------------------------面板 end------------------------------------>

  </div>
  </form>
  </body>
</html>

<script src="<%=basePath%>js/bootstrap.min.js"></script>
<!--<script type="text/javascript" src="js/bootstrapValidator.js"></script>-->
<script src="<%=basePath%>js/bootstrap-paginator.min.js"></script>
<script src="<%=basePath%>/js/respond.js"></script>
<script src="<%=basePath%>/js/html5.js"></script>
<script src="<%=basePath%>js/toastr/toastr.js"></script>
<script src="<%=basePath%>js/bootbox.js"></script>
<script src="<%=basePath%>js/jquery.validate.js"></script>
<!-- <script src="<%=basePath%>js/additional-methods.min.js"></script> -->
<script src="<%=basePath%>js/my-jquery-curd.js"></script>
<script src="<%= basePath %>js/tableSortTool.js" ></script>
<script src="<%= basePath %>js/calendar.js" ></script>
<script type="text/javascript">
	//初始化页面及校验
	$().ready(function(){
	//1、校验脚本初始化，start check
	$.validator.addMethod("valipassword",function(value){
		var s='${FREE_CURRENT_USER_OBJ.password}';
			return s!=value?false:true;
            },"<font color='red'>老密码不正确!</font>");
	$("#ffAdd").validate({
		submitHandler:function(form){
	    },
	    rules: {
	    	oldpassword: {
			    required: true,
			    valipassword : true,
    		},
    		newpassword: {
			    required: true,
    		},
    		renewpassword: {
    			equalTo: '#newpassword',
    		},
	    }, //end rules;
	    messages: {
	    	oldpassword: {
			    required: "<font color='red'>老密码不能为空！</font>",
    		},
    		newpassword: {
    			required: "<font color='red'>新密码不能为空！</font>",
    		},
    		renewpassword: {
    			equalTo: "<font color='red'>两次新密码修改不一致!</font>",
    		},
	   } //end message;
   	}); //end validate;
}) //end funciton read;

	//2、密码修改
	function mdfsubmit(){
		var oldpassword = document.getElementById('oldpassword').value;
		if(oldpassword==null || oldpassword ==''){
			document.getElementById("oldpassword").focus();
			return false;
		}
		var newpassword = document.getElementById('newpassword').value;
		var renewpassword = document.getElementById('renewpassword').value;
		if(newpassword==null || newpassword ==''){
			document.getElementById("newpassword").focus();
			return false;
		}else if(newpassword!=renewpassword){
			document.getElementById("renewpassword").focus();
			return false;
		}
		$("#top_xgmm").attr("disabled", true);
		var url = "<%=basePath%>t_user/updateP_userP?time="+Math.random();
		myEdit2(url);
	}
</script>
